<template>
	<view class="content">
		<view class="cont">
			<view class="title">提货券验证</view>
			<view class="line">
				<input type="text" v-model="cardNo" class="lineInput" placeholder="请输入提货券编号">
			</view>
			<view class="explainTitle">说明</view>
			<view class="explainLine">1.未制卡：该卡未制作发售</view>
			<view class="explainLine">2.已制卡：该卡已制作，未发售，样品卡</view>
			<view class="explainLine">3.已销售：该卡已销售，可正常兑换</view>
			<view class="explainLine">4.兑换中：该卡为多次卡，已开启兑换权益</view>
			<view class="explainLine">5.兑换结束：该卡已兑换结束，失效</view>
			
			
		</view>
		<view class="SubmitBtnBOx">
			<view class="SubmitBtn" @click="validate">立即验证</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cardNo: '',
				dictTypeList:'',
			}
		},
		onLoad() {
           this.cardStatus()
		},
		methods: {
			cardStatus(){
				this.$http('system/dict/data/type/card_status',{
					},'GET').then(res => {
						this.dictTypeList=res.data
					})
			},
			validate(){
				this.$http('delivery/card/one',{
					cardNo:this.cardNo,
					noPsd:true,
				},'GET').then(res => {
					   //console.log(res)
					   
						if(!res.data){
							uni.showToast({
								 title: '请输入正确的劵码',
								 icon:'none',
								 duration: 3000
							});
						}else{
							this.dictTypeList.forEach(item=>{
								if(item.dictValue == res.data.cardStatus){
									uni.showToast({
										 title: item.dictLabel,
										 icon:'none',
										 duration: 3000
									});
								}
							})
							
							
						}
				 })
			},
            tis(){
				/* uni.showModal({
				        title: '提示',
				        content: '该券码暂未兑换',
				        success: function(res) {
				        if (res.confirm) {
				            // 执行确认后的操作
				        } 
				        else {
				            // 执行取消后的操作
				        }
				    }
				}) */
			}
		}
	}
</script>

<style scoped>
	.cont{
		background: #fff;
		padding: 20rpx;
	}
	.title{
		color: #333333;
		font-size: 30rpx;
		border-bottom: #eeeeee 1px solid;
		padding-bottom: 20rpx;
	}
	.lineInput{
		height: 80rpx;line-height: 80rpx;
		padding-left: 20rpx;
		border: 1px solid #D7D7D7;
		border-radius: 10rpx;
		font-size: 28rpx;
	}
	.line{
		padding: 20rpx 0;
	}
	.SubmitBtn{
		height: 90rpx;
		text-align: center;
		line-height: 90rpx;
		font-size: 30rpx;
		background: #D53533;
		color: #fff;
		margin-top: 50rpx;
		border-radius: 10rpx;
	}
	.SubmitBtnBOx{
		padding: 20rpx;
	}
	.explainTitle{
		font-size: 32rpx;
		padding: 30rpx;
		color: #666;
	}
	.explainLine{
		font-size: 28rpx;
		padding: 15rpx 30rpx;
		color: #999;
	}
</style>
